//
//  CYYTableViewCell.m
//  LetsParty
//
//  Created by rimi on 15/9/14.
//  Copyright (c) 2015年 LetsPartyTeam. All rights reserved.
//

#import "CYYTableViewCell.h"

@interface CYYTableViewCell ()

- (void)initializeUserInterface;

@end

@implementation CYYTableViewCell

#pragma mark - init
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initializeUserInterface];
    }
    return self;
}

#pragma mark - private methods
- (void)initializeUserInterface{
    [self addSubview:self.titleLabel];
    [self addSubview:self.editButton];
    [self addSubview:self.leftButton];
}

#pragma mark - getter
- (UIButton *)leftButton{
    if (!_leftButton) {
        _leftButton = ({
            UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = DHFlexibleFrame(CGRectMake(5, CGRectGetMidY(self.frame) - 12.5, 25, 25), NO);
            button;
        });
    }
    return _leftButton;
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = ({
            UILabel * label = [[UILabel alloc]init];
            label.frame = CGRectMake(30, 0, 255, self.frame.size.height);
            label;
        });
    }
    return _titleLabel;
}
- (UIButton *)editButton{
    if (!_editButton) {
        _editButton = ({
            UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = DHFlexibleFrame(CGRectMake(280, CGRectGetMidY(self.frame) - 12.5, 25, 25), NO);
            button;
        });
    }
    return _editButton;
}



@end
